﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Module_BBS_List.ascx.cs" Inherits="Modules_Module_BBS_List" %>
<asp:GridView DataKeyNames="id" ID="GridView1" runat="server" AllowPaging="True" 
    AutoGenerateColumns="False" DataSourceID="SqlDataSource1" Width="600px" 
    BackColor="White" GridLines="None" onrowcreated="GridView1_RowCreated">
            <Columns>
                <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True">
                 <HeaderStyle HorizontalAlign="Left" Width="10px"/>
                    <ItemStyle HorizontalAlign="Left" Width="10px"/>
                </asp:BoundField>
                
                <asp:TemplateField HeaderText="序号">
                  <HeaderStyle HorizontalAlign="Center" Width="50px" />
                  <ItemStyle HorizontalAlign="Center" Width="50px" />
                  <ItemTemplate> 
                     <%# Container.DataItemIndex + 1%> 
                  </ItemTemplate>
               </asp:TemplateField>
                
               <asp:TemplateField HeaderText="标题">
                 <HeaderStyle HorizontalAlign="Left" Width="350px" />
                 <ItemStyle HorizontalAlign="Left" Width="350px" />
                <ItemTemplate>
                     <a href='./BBS_Content.aspx?BBSID=<%# Eval("id") %>' title='<%#Eval("id") %>' target="_self" ><%# Eval("title") %></a><br />                                            
                </ItemTemplate>
               </asp:TemplateField>
                               
                <asp:BoundField DataField="time" HeaderText="发帖时间" ReadOnly="True" HtmlEncode="false"
                    DataFormatString="{0:yyyy-MM-dd HH:mm:ss }">
                    <HeaderStyle HorizontalAlign="Center" />
                    <ItemStyle HorizontalAlign="Center" Width="200px" />
                </asp:BoundField>
                
               <asp:TemplateField HeaderText="删除">
                 <HeaderStyle HorizontalAlign="Left" Width="50px" />
                 <ItemStyle HorizontalAlign="Left" Width="50px" />
                <ItemTemplate>
                     <a href="./BBS_Delete.aspx?BID=<%#Eval("id") %>" title="<%#Eval("id") %>" target="_self" >删除</a><br />                                           
                </ItemTemplate>
               </asp:TemplateField>
               
            </Columns>
            <HeaderStyle BackColor="#003366" Height="30px" />
            <AlternatingRowStyle BackColor="#99CCFF" Wrap="False" />
</asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:allshareConnectionString3 %>" 
    ProviderName="<%$ ConnectionStrings:allshareConnectionString3.ProviderName %>" 
    SelectCommand="SELECT * FROM bbs WHERE parent=0 ORDER BY time DESC">
</asp:SqlDataSource>

标题：<asp:TextBox ID="TextBox_title" runat="server"></asp:TextBox><br />
内容：<asp:TextBox ID="TextBox_content" runat="server"></asp:TextBox><br />
<asp:Button ID="Button_submit" runat="server" Text="确认发帖" onclick="submit_Click" />
